
<div class="form-group">
    <label class="col-sm-2 control-label" >商品图片：</label>
    <div class="col-sm-10">
        <div class="js_upload_container">
            <div class="js_file_upload ">
                <button type="button" class="btn btn-default js_new_upload" data-submitname="GoodsImages" data-count="10" data-uploadpath="{:url('mainAdmin/attachment/goodsUpload')}" data-delpath="{:url('mainAdmin/attachment/removeImg')}" data-data="{ 'gid':'{$row.goods_id|intval}' }" style="position: relative; z-index: 1;">商品图片</button>
                <span class="maroon">*</span>
                <span class="help-inline">(建议尺寸：640*640或800*800)默认显示第1张图片，最多10张 (<small>可拖拽图片调整显示顺序 </small>)</span>
            </div>
            <div class="uploadify-queue js_file_upload_queue">
            </div>
             <ul class="ipost-list ui-sortable js_fileList" data-required="true">
{volist name="goods_imgs" id="gg"  }
<li class="imgbox" data-post-id="{$gg.img_id}" data-path="{$gg.goods_img}">
<a class="item_new_close item_close" href="javascript:void(0)" data-delpath="{:url('mainAdmin/attachment/removeImg')}"  title="删除" data-path="{$gg.goods_img}" data-post-id="{$gg.img_id}"></a>  
<input value="{$gg.img_id}" name="GoodsImages[id][]" type="hidden"> 
<input value="{$gg.goods_img}" name="GoodsImages[path][]" type="hidden"> 
<span class="item_box"><img src="{$gg.goods_thumb}"></span>
</li>
{/volist}                                           
             </ul>
        </div>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-2 control-label" >商品视频：</label>
    <div class="col-sm-10">
        <div class="js_upload_container">
            <input type="text" id="video_url" name="video_url" class="input-max hide" value="{$row.video_url}"/>
            <button type="button" class="btn btn-default js_file_upload" data-file_type="video" data-uploadpath="{:url('mainAdmin/attachment/uploadVideo')}" style="position: relative; z-index: 1;">点击上传视频
            </button>
            <span style="color:red;margin-top:0.5rem">只支持上传mp4，大小不能超过20mb，</span>
            <a href="javascript:;" onclick="payVideo()" >点击显示视频</a>
        </div>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label">视频封面：</label>
    <div class="controls col-sm-3">
        <div class="defUpImgBox"  data-toggle="uploaderImg" style="width: 130px; height: 130px">
            <img  src="{$row.video_cover|default='__STATIC__/main/img/image.png'}">
            <input type="hidden"  name="video_cover"  value="{$row.video_cover}">
            <div class="tips">点击上传</div>
        </div>
        <span class="help-inline">(建议尺寸：同上面商品图片大小一致)</span>
    </div>
    <div class="col-sm-3 hide" id="video_box"><video controls  style="width: 100%"></video></div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label" >视频显示位置：</label>
    <div class="col-sm-10">
        <label class="radio-inline">
            <input type="radio" name="video_position" value="0" {$row.video_position|tplckval='=0','checked',true} >不显示
        </label>
        <label class="radio-inline">
            <input type="radio" name="video_position" value="1" {$row.video_position|tplckval='=1','checked'} >商品轮播图（首位）
        </label>
        <label class="radio-inline">
            <input type="radio" name="video_position" value="2" {$row.video_position|tplckval='=2','checked'}  /> 商品详情
        </label>
    </div>
</div>
<div class="line line-dashed line-lg pull-in" ></div>
<div  class="form-group" >
    <label class="col-sm-2 control-label">商品规格：</label>
    <div class="col-sm-10">
        {if condition="$row.goods_id > 0" }
         <div ><span class="help-inline"> {$row.is_spec==0?'统一规格':'多规格'}</span></div>
        {/if}
            <div class="f-l {$row['goods_id'] < 1?'':'hide'}">
                <label class="radio-inline">
                    <input type="radio" name="is_spec" value="0" data-toggle="specification-enable" data-enable="false"  {$row.is_spec|tplckval='=0','checked',true}  />统一规格
                </label>
                <!--<label class="radio-inline">
                    <input type="radio" name="is_spec" value="1"  data-toggle="specification-enable" data-enable="true" {$row.is_spec|tplckval='=1','checked'}/>
                    多规格</label>
                <span class=" help-inline">*添加商品后不能修改规格</span>-->
            </div>

            <div class="m-t-md col-sm-8 specificationstable hd">

                选择商品模型
                {if condition="$row.goods_id < 1" }
                <select name="sku_model" id="skuModelId" {$is_supplyer==true?'disabled':''} data-toggle="changeSkuModelId">
                {$skuModelOpt|raw}
                </select>
                <span  style="color:#f30;">* 修改模型，将会删除旧有的sku记录</span>
                {else/}
                <select disabled id="skuModelId" {$is_supplyer==true?'disabled':''} data-toggle="changeSkuModelId">
                    {$skuModelOpt|raw}
                </select>
                <input type="hidden" name="sku_model" value="{$row.sku_model|intval}">
                {/if}

            </div>
        <div class="clearfix"></div>
        <div data-toggle="specifications" class="hd {$is_supplyer?'hide':''}"><i class="fa fa-spinner fa-spin"></i></div>
    </div>
</div>
<div class="line line-dashed line-lg pull-in specificationstable hd" style="width:98%;"></div>

<div class="form-group specificationstable hd">
    <label class="col-sm-2 control-label">价格&库存：</label>
    <div class="table-responsive tab-content p-l" style="width:81%;" data-toggle="specificationstable">
        <span class="help-inline p-t ">请选择规格</span>
    </div>
</div>

<div class="nospecifications {$row['is_spec']==1?'hd':''}">
    {if condition="$is_supplyer == false" }
    <div class="form-group">
        <label class="col-sm-2 control-label">货号：</label>
        <div class="col-sm-4 ">
            <input type="text" class="input-medium" name="goods_sn" value="{$row.goods_sn}" data-rule-maxlength="20" data-rule-required="true" data-msg-required="商品货号不能为空">
            <span  style="color:#f30;"> *</span>
        </div>
        <div class="help-inline"></div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">条形码：</label>
        <div class="col-sm-2 ">
            <input type="text" class="input-medium" name="bar_code" value="{$row.bar_code}" data-rule-maxlength="20" >
        </div>
        <div class="help-inline"></div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">重量：</label>
        <div class="col-sm-2">
            <div class="input-group" style="width: 180px;">
                <input type="text" class="input-medium" name="goods_weight" data-rule-min="0"  data-rule-number="true"  value="{$row.goods_weight}">
                <span class="input-group-addon">g</span>
            </div>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">销售价：</label>
        <div class="col-sm-4">
            <input type="text" class="input-mini" name="shop_price" min="0.01" data-rule-ismoney="true" data-rule-required="true" data-msg-required="销售价不能为空" value="{$row.shop_price}">
            元<span  style="color:#f30;"> *</span>
        </div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">市场价：</label>
        <div class="col-sm-4">
            <input type="text" class="input-mini" name="market_price" data-rule-ismoney="true" value="{$row.market_price}">元
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">库存：</label>
        <div class="col-sm-8">
            {$row['goods_id']>0?'当前库存：'.$row['goods_number'].' + ':''}<input type="text" class="input-mini" name="goods_number" data-rule-number="true" data-rule-required="true" data-msg-required="库存不能为空" value="{$row['goods_id']>0?'0':''}">
            <span class="red">*</span>
        </div>
    </div>
    {else}
    <div class="form-group">
        <label class="col-sm-2 control-label">货号：</label>
        <div class="col-sm-4 ">
            <div class="help-inline">{$row['goods_sn']}</div>
        </div>
        <div class="help-inline"></div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">条形码：</label>
        <div class="col-sm-2 ">
            <div class="help-inline">{$row['bar_code']}</div>
        </div>
        <div class="help-inline"></div>
    </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">重量：</label>
        <div class="col-sm-2">
            <div class="input-group" style="width:50px;">
                <input type="text" class="input-mini" name="goods_weight" data-rule-min="0"  data-rule-number="true"  value="{$row.goods_weight}">
                <span class="input-group-addon">g</span>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">市场价：</label>
        <div class="col-sm-8">
            <div class="help-inline">{$row['market_price']|priceFormat=true}</div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">库存：</label>
        <div class="col-sm-8">
           <div class="help-inline"> {$row['goods_number']}</div>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">供货价：</label>
        <div class="col-sm-4">
            <div class="help-inline red"><b>{$row.settle_price|priceFormat=true}</b></div>
            <input type="hidden" name="settle_price" value="{$row.settle_price}">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">销售价：</label>
        <div class="col-sm-4">
            <input type="text" class="input-mini" name="shop_price" min="0.01" data-rule-ismoney="true" data-rule-required="true" data-msg-required="销售价不能为空" value="{$row.shop_price}">
            元<span  style="color:#f30;"> *</span>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">促销价：</label>
        <div class="col-sm-8">
            <input type="text" class="input-mini" data-rule-ismoney="true" name="promote_price" value="{$row.promote_price}" >元
            <span class="help-inline">促销期间以此价格进行销售</span>
        </div>
    </div>
    {/if}
</div>
<div class="form-group">
    <label class="col-sm-2 control-label">排序：</label>
    <div class="col-sm-8">
        <input type="text" class="input-mini" name="sort_order"  data-rule-min="0" data-rule-max="9999" data-rule-number="true" value="{$row['sort_order']}">
        <span class="help-inline">数值越大越靠前</span>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-2 control-label"></label>
    <div class="col-sm-8">
        <label class="radio inline">
            <input type="checkbox" name="is_credit_amount" onchange="changeCreditAmount()" value="1" {$row.is_credit_amount|tplckval='=1','checked'}> 积分可抵金额
        </label>
    </div>
</div>

<div class="form-group" id="credit_amount_points" {if condition="$row.is_credit_amount neq 1"} style="display: none" {/if}>
    <label class="col-sm-2 control-label">积分设置：</label>
    <div class="col-sm-8">
        可抵扣<input type="text" class="input-mini" data-rule-number="true" name="credit_amount_points" value="{$row.credit_amount_points}" >积分（1积分={$systemSettingTpl['integral_value']}元）
    </div>
</div>

<script type="text/javascript">
    function payVideo() {
        var video = $('#video_url').val();
        if (video == ''){
            return _alert('请上传视频后再操作.');
        }
        $('#video_box').removeClass('hide');
        $('#video_box').find('video').attr('src',video);
    }

    function changeCreditAmount() {
        var is_credit_amount=0;
        $('input[name="is_credit_amount"]:checked').each(function(){
            is_credit_amount = $(this).val();
        });
        if (is_credit_amount==1) {
            $("#credit_amount_points").show();
        } else {
            $("#credit_amount_points").hide();
            $('input[name="credit_amount_points"]').val('');
        }
        // console.log(is_credit_amount)
    }

</script>